<?php 
	include_once("./head.php");
	include_once("./commonality.php");
	if(!isset($_SESSION['account'])){
		tankuang("请登录","./register1.php");
		exit;
	}	
	$set="select * from product";
	$res=mysql_query($set);
	while($list=mysql_fetch_assoc($res)){
	$sets[]=$list;
	}
	
 ?>
<!DOCTYPE html>
 <html>
 <head>
 	<title></title>
 </head>
	<style>
	.c1{
		width:10%;
		height:40px;
		/*border:1px solid red;*/
		margin-left:60px;
		font-size:18px;

	}
	.c2 ul li{
		float:left;
		list-style:none;
		margin-left:110px;
		font-size:20px;
		}
	.c10{
		width:120px;
		height:100px;
		/*border:1px solid red;*/
		margin-left:130px;
		margin-top:0px;

	}

	.c3{
		width:80px;
		height:100px;
		/*border:1px solid red;*/
		margin-left:320px;
		margin-top:-100px;
	}
	.c4{
		width:130px;
		height:20px;
		/*border:1px solid red;*/
		margin-left:480px;
		margin-top:-100px;

	}
	.c5{
		width:80px;
		height:20px;
		/*border:1px solid red;*/
		margin-left:680px;
		margin-top:-20px;
	}
	.c6{
		width:90px;
		height:30px;
		/*border:1px solid red;*/
		margin-left:810px;
		margin-top:-20px;
	}
	.c6 input{
		width:50px;
	}
	.c9{
		width:80px;
		height:30px;
		/*border:1px solid red;*/
		margin-left:980px;
		margin-top:-25px;
	}

	.c7{
		width:100px;
		height:30px;
		/*border:1px solid red;*/
		margin-left:1110px;
		margin-top:-32px;
	}
	.c8{
		width:100%;
		height:110px;
		/*border:1px solid red;*/
	}
	.close{
		width:160px;
		height:50px;
		background:#2894ff;
		display:inline-block;
		margin-top:30px;
		margin-left:1000px;
		margin-right:100px;
		line-height:50px;
		text-align:center;
		color:white;
		font-size:20px;
		border-radius:4px;
	}
	.color9{
		width:30px;
		height:30px;
		display:inline-block;
	}
	
	</style>
 <body>

	<span class="c1">当前所在：商城>购物车</span><hr color="#d1d1d1"><br><br>
	<div class="c2">
		<ul>
			<li>商品名称</li>
			<li>图片</li>
			<li>商品信息</li>
			<li>单价</li>
			<li>数量</li>
			<li>小计</li>
			<li>操作</li>
		</ul>
	</div>
	<div style="clear:both"></div>
	<hr>
<?php if(count($_SESSION['cart'])) { ?>
	<?php foreach ($sets as $k=>$v) { ?>
		<?php foreach($_SESSION['cart'] as $key=>$value){ ?>
		<?php	if($value['pid']==$v['pid'] ){ ?>
	<form action="jiajian.php">
		<input type="hidden" name="pid" value="<?=$value['pid']?>">
	<div class="c8">
		<div class="c10"><?= $v['pname']?></div>
		<div class="c3"><img src="./uploads/<?= $v['pimg']?>" width="80px"></div>
		<div class="c4"><?= $value['size'] ?><br><div class="color9"style="background:<?= $value['color'] ?>"></div></div>
		<div class="c5"><?= $v['price']?></div>		
		<div class="c6">
		<a style="text-decoration:none;" href="./jiajian.php?pid=<?= $value['pid']?>&type=1">-</a>
		<input type="text" name="number" value="<?=$value['num']?>">
		<a style="text-decoration:none;" href="./jiajian.php?pid=<?= $value['pid']?>&type=2">+</a>
		</div>
		<div class="c9"><?= $v['price']*$value['num']?></div>
		<div class="c7">
		<button>修改</button>
		<a href="xiugai.php?pid=<?= $value['pid']?>">删除</a>
		</div>
	</div>	
<hr style=" height:3px;border:none;border-top:2px dotted #1281E3;" />
<?php 
		} 
 	} 
 } 
 ?>
	<a href="close.php"><span class="close">去结算</span></a>	
	</form>

<?php }else{ 
	echo "什么宝贝也没有去加点宝贝吧！";
}?>
 </body>
 </html>